#ifndef __PTRPOLICIES_H__
#define __PTRPOLICIES_H__

namespace inf {

    /*
    ============
    NULLPtrCheck
    ============
    */
    template< class T >
    class NULLPtrCheck {
    public:
        typedef T* pointer;
        static void check( const pointer p ) {
            assert( p != NULL && "NULL pointer dereferenced!" );
        }
    };

    /*
    ============
    NoPtrCheck
    ============
    */
    template< class T >
    class NoPtrCheck {
    public:
        typedef T* pointer;
        static void check( const pointer p ) {}
    };

    /*
    ============
    DefaultCleanupPolicy
    standard cleanup via delete
    ============
    */
    template< class T >
    class DefaultCleanupPolicy {
    public:
        typedef T* pointer;

        static void free( pointer p ) {
            delete p;
        }
    };

    /*
    ============
    WeakCleanupPolicy
    do nothing
    ============
    */
    template< class T >
    class WeakCleanupPolicy {
    public:
        typedef T* pointer;

        static void free( pointer p ) {
        }
    };

    /*
    ============
    ArrayCleanupPolicy
    ============
    */
    template< class T >
    class ArrayCleanupPolicy {
    public:
        typedef T* pointer;

        static void free( pointer p ) {
            delete [] p;
        }
    };

    /*
    ============
    AlignedMemCleanupPolicy
    ============
    */
    template< class T >
    class AlignedMemCleanupPolicy {
    public:
        typedef T* pointer;

        static void free( pointer p ) {
            Mem_FreeAligned( p );
        }
    };


}   // ::inf

#endif // ! __PTRPOLICIES_H__
